//
//  XQBatteryTool.swift
//  Spark Peso
//
//  Created by 小琦 on 2025/2/3.
//

import UIKit

class XQBatteryTool: NSObject {

    static func getBatteryInfo() {
        
        var pool: String = ""
        var eliminated: String = ""
        
        let batteryLevel = UIDevice.current.batteryLevel
        
        let batteryState = UIDevice.current.batteryState
        
        pool = String(format: "%.0f", abs(batteryLevel * 100))
        
        if batteryState == .charging {
            eliminated = "1"
        } else {
            eliminated = "0"
        }

        let batteryDic: [String: String] = [
            "pool": pool,
            "eliminated": eliminated
        ]

        XQAnalysisManager.shared.batteryInfo = batteryDic
    }
    
    
}
